home *** CD-ROM | disk | FTP | other *** search
- Path: hobbes.sco.COM!md
- From: md@sco.COM (Michael Davidson)
- Newsgroups: comp.lang.c
- Subject: Re: What's your compiler's answer?
- Date: 19 Feb 1996 07:55:20 GMT
- Organization: The Santa Cruz Operation, Inc.
- Message-ID: <4g9ad8$acg@hobbes.sco.COM>
- References: <1996Feb7.140945.28351@cs.rit.edu> <4fq0cq$h9s@hpbblb.bbn.hp.com> <danpop.824432113@rscernix> <4g2a1d$r33@solutions.solon.com>
- NNTP-Posting-Host: execsrvr.research.sco.com
- Cc:
-
-
- In article <4g2a1d$r33@solutions.solon.com>,
- Peter Seebach <seebs@solutions.solon.com> wrote:
- >In article <danpop.824432113@rscernix>, Dan Pop <danpop@mail.cern.ch> wrote:
- >>j = i++, i++, i++; /* equivalent to: j = i + 2; i += 3; */
- >
- >Don't you mean "/* equivalent to: j = i; i += 3; */"?
- >
- [ ... ]
- >
- >I can't seem to find mine, but I'm pretty sure that comma binds later than
- >assignment, or however you say it. (Not "comma has lower precedence" - C
- >has no precedence, although it may act convincingly like it does.)
- >
- Apologies - please ignore my previous response to this (it's almost midnight,
- and I must be getting tired. You are, of course, perfectly correct - the
- comma operator does (to use the conventional word) have lower precedence
- than assignment.
-
- So -
-
- j = i++, i++, i++;
-
- is indeed equivalent to: j = 1; i += 3;
-
- for it to have been equivalent to: j = i + 2; i += 3;
- it would have to have been written as: j = (i++, i++, i++);
-
- which, of course, it wasn't ...
-